<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="UTF-8">
    <meta name="referrer" content="no-referrer"/>
    <link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/loading-icon.css">
    <link rel="stylesheet" type="text/css" href="/static/css/Common.css">
    <title>客户信息</title>
</head>
<body>
<div class="sk-three-bounce" id="sk-three-bounce" style="display: none">
    <div class="sk-child sk-bounce1"></div>
    <div class="sk-child sk-bounce2"></div>
    <div class="sk-child sk-bounce3"></div>
</div>
<div style="width: 100%;height: 100%;padding: 0;margin: 0" id="main_viewer">
    <div>
        <div style="margin-top: 3px" id="increase" class="layui-btn layui-btn-warm layui-btn-sm"
             sec:authorize="hasAnyRole('manager','admin')">增加</div>
        <table lay-filter="demo">
            <thead>
            <tr>
                <th lay-data="{field:'product_id',sort:true}">产品编号</th>
                <th lay-data="{field:'product_name',sort:true}">产品名</th>
                <th lay-data="{field:'discription',sort:true}">产品描述</th>
                <th lay-data="{field:'floor',sort:true}">产品起售金额</th>
                <th lay-data="{field:'sale_location',sort:true}">销售范围</th>
                <th lay-data="{field:'last_time',sort:true}">产品周期</th>
                <th lay-data="{width:200, toolbar:'#barDemo'}">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="record:${results}">
                <td th:text="${record.product_id}">产品编号</td>
                <td th:text="${record.product_name}">产品名</td>
                <td th:text="${record.discription}">产品描述</td>
                <td th:text="${record.floor}">产品起售金额</td>
                <td th:text="${record.sale_location}">销售范围</td>
                <td th:text="${record.last_time}">>产品周期</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<div id="flow_block" class="layui-form" style="display: none">
    <form method="post" class="layui-form layui-form-pane" style="margin: 10px" action="/addProduct">
        <div class="layui-form-item">
            <label class="layui-form-label">产品编号</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="product_id">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品名</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" lay-verify="required" name="product_name">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品描述</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" lay-verify="required" name="discription">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品起售金额</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="floor">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">销售范围</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" lay-verify="required" name="sale_location">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品周期</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="last_time">
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <input type="submit" value="保存" class="layui-btn layui-btn-normal">
        </div>
    </form>
</div>


<div id="flow_block1" class="layui-form" style="display: none">
    <form method="post" class="layui-form layui-form-pane" style="margin: 10px" action="/buyProduct">
        <div class="layui-form-item">
            <label class="layui-form-label">产品编号</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="product_id" id="product_id2">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户ID</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="client_id" id="client_id2">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">购买金额</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="amount">
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <input type="submit" value="确定购买" class="layui-btn layui-btn-normal">
        </div>
    </form>
</div>

<div id="flow_block2" class="layui-form" style="display: none">
    <form method="post" class="layui-form layui-form-pane" style="margin: 10px" action="/updateProduct">
        <div class="layui-form-item">
            <label class="layui-form-label">产品编号</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="product_id" id="product_id">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品名</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" lay-verify="required" name="product_name" id="product_name">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品描述</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" lay-verify="required" name="discription" id="discription">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品起售金额</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="floor" id="floor">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">销售范围</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" lay-verify="required" name="sale_location" id="sale_location">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品周期</label>
            <div class="layui-input-inline">
                <input type="number" class="layui-input" lay-verify="required|number" name="last_time" id="last_time">
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <input type="submit" value="保存" class="layui-btn layui-btn-normal">
        </div>
    </form>
</div>



<script type="text/javascript" src="/static/js/jquery-3.4.1.js"></script>
<script type="text/javascript" src="/static/js/echarts.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/LoadingJS.js"></script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-warm layui-btn-sm" lay-event="buy" sec:authorize="hasAnyRole('client','admin')">购买</a>
    <a class="layui-btn layui-btn-sm" lay-event="edit" sec:authorize="hasAnyRole('manager','admin')">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del" sec:authorize="hasAnyRole('manager','admin')">删除</a>
</script>
<script>
    var table = layui.table;

    //转换静态表格
    table.init('demo', {
        limit: 8 //注意：请务必确保 limit 参数（默认：10）是与你服务端限定的数据条数一致
        //支持所有基础参数
        ,page:true
        ,limits: [8,16,24,32,40,48,56,64,72]
    });
</script>
<script type="text/javascript" src="/static/js/ProductViewer.js"></script>
</body>
</html>

